package bookExercise;

import java.io.File;

public class A17file {
    public static void main(String[] args) {
        //存在的文件
        File f =new File("D:\\aaa.txt");
        System.out.println(f.isFile());
        System.out.println(f.isDirectory());
        System.out.println( f.exists());
        long length = f.length();
        System.out.println(length);
        String Path1 = f.getAbsolutePath();
        System.out.println(Path1);
        String name1 = f.getName();
        System.out.println(name1);
        long l = f.lastModified();
        System.out.println(l);
        System.out.println("---------------");
        //存在的文件夹
        File f2 =new File("D:\\aaa");
        System.out.println(f2.isFile());
        System.out.println(f2.isDirectory());
        System.out.println( f2.exists());
        long length1 = f2.length();
        System.out.println(length1);
        String Path2 = f2.getAbsolutePath();
        System.out.println(Path2);
        String name2 = f2.getName();
        System.out.println(name2);
        System.out.println("---------------");
        //不存在的文件
        File f3 =new File("D:\\aaa\\bbb.txt");
        System.out.println(f3.isFile());
        System.out.println(f3.isDirectory());
        System.out.println( f3.exists());
        System.out.println("---------------");

    }
}
